﻿<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title></title>
    <script src="~/js/frame.js"></script>
    <script src="~/lib/encrpt/jsencrypt.min.js"></script>
    <style>
        #container {
            background: url(../../images/login_bg.jpg);
            height: 100%;
            width: 100%;
        }

        #logininfo {
            position: absolute;
            top: 50%;
            margin: -100px 0 0 200px;
        }

        #content {
            width: 350px;
            background: url(../../images/login_shadow.png);
            position: absolute;
            top: 50%;
            left: 50%;
            margin: -150px 0 0 250px;
        }

        .loginbtn {
            padding: 10px 16px !important;
            font-size: 14px !important;
            line-height: 1.25 !important;
            border-radius: 4px !important;
            height: 35px !important;
        }

        .logintitle {
            height: 40px;
            line-height: 40px;
            font-size: 14px;
            padding-left: 20px;
            font-weight: bold;
            color: #FFFFFF;
            letter-spacing: 5px;
            background-color: grey;
        }

        .logincontent {
            padding: 5px 10px !important;
        }

        .logininput {
            height: 40px !important;
            font-size: 12px !important;
            padding-left: 50px !important;
        }

        .loginrow {
            margin-top: 5px !important;
            margin-bottom: 5px !important;
        }

        .loginicon {
            font-size: 25px;
            line-height: 50px;
            margin-left: 5px
        }

        .loginbottom {
            padding-left: 10px !important;
            padding-right: 10px !important;
            display: flex !important;
            flex-direction: column !important;
        }
    </style>
</head>
<body>
    <div id="container">
        <div id="logininfo" style="display:flex;flex-direction:column">
            <span style="font-size:30px;color:white">FastExecutorCore&nbsp;&nbsp;&nbsp;&nbsp;你想要的我全都有</span>
            <div style="height:20px"></div>
            <span style="font-size:18px;color:white">生活最好的状态就是冷冷清清的风风火火</span>
        </div>
        <div id="content">
            <div class="logintitle">
                <div class="col-xs-12">
                    <span style="font-size:14px">账号登陆</span>
                </div>
            </div>

            <div class="container-fluid logincontent">
                <form id="form">
                    <div class="formrow" style="margin-bottom:5px;margin-top:5px">
                        <div class="col-xs-12 loginrow">
                            <div class="input-control has-icon-left" style="width:100%;">
                                <input id="LoginID" name="LoginID" type="text" class="form-control logininput" placeholder="用户名">
                                <label for="LoginID" class="input-control-icon-left"><i class="icon icon-user loginicon" style="height:40px;line-height:40px"></i></label>
                            </div>
                        </div>
                    </div>
                    <div class="formrow" style="margin-bottom:5px;margin-top:5px">
                        <div class="col-xs-12 loginrow">
                            <div class="input-control has-icon-left has-icon-right" style="width:100%">
                                <input id="Password" name="Password" type="password" class="form-control logininput" placeholder="密码">
                                <label for="Password" class="input-control-icon-left"><i class="icon icon-lock loginicon" style="height:40px;line-height:40px"></i></label>
                            </div>
                        </div>
                    </div>
                    <div class="formrow" style="margin-bottom:5px;margin-top:5px;display:none" id="verfiycontainer">
                        <div class="col-xs-12 loginrow">
                            <div class="input-control has-icon-left has-icon-right" style="width:100%;display:flex;flex-direction:row;align-items:center">
                                <input id="VerfiyCode" name="VerfiyCode" class="form-control logininput" placeholder="验证码" style="width: 220px">
                                <div style="width:100px;margin-left:10px;height:40px;background-color:#EBF2F9;text-align:center;cursor:pointer" onclick="RefreshVerifyCode()">
                                    <span style="font-size: 25px;letter-spacing:8px;color:#6B84A2" id="VerfiyCodeSpan">xxxx</span>
                                </div>
                                <label for="VerfiyCode" class="input-control-icon-left"><i class="icon icon-asterisk loginicon" style="height:40px;line-height:40px"></i></label>
                            </div>
                        </div>
                    </div>
                    <textarea id="RSAPublicKey" style="display:none;">@ViewBag.RSAPublicKey</textarea>
                </form>
            </div>
            <div class="formrow" style="margin-bottom:5px;margin-top:5px">
                <div class="col-xs-12 loginbottom">
                    <div style="width:100%;display:flex;justify-content:flex-start;flex-direction:row">
                        <input id="RemeberUser" type="checkbox" style="margin-left:10px"> <label style="color:white" for="RemeberUser">记住用户</label>
                    </div>
                    <button class="btn btn-primary loginbtn" type="button" style="width:100%;margin-bottom:10px" onclick="UserLogin()">登&nbsp;&nbsp;&nbsp;&nbsp;陆</button>
                </div>
            </div>
        </div>
    </div>
    <script>

        $(function () {
            var RemeberUser = new Boolean(GetLocalData("RemeberUser"));
            if (RemeberUser == true) {
                $("#RemeberUser").prop('checked', true);
                $("#LoginID").val(GetLocalData("LoginID"));
                $("#Password").val(GetLocalData("Password"));
            }
            if ('@ViewData["OpenVerifyCode"]' == 'True') {
                $("#verfiycontainer").show();
                $("#VerfiyCodeSpan").text('@ViewData["VerifyCode"]')
            }
            $(document).keyup(function (event) {
                if (event.keyCode == 13) {
                    UserLogin();
                }
            });
        })

        function UserLogin() {
            var RemeberUser = $("#RemeberUser").prop('checked');
            var param = $("#form").GetForm();
            if (RemeberUser) {
                SetLocalData("RemeberUser", RemeberUser);
                SetLocalData("LoginID", $("#LoginID").val());
                SetLocalData("Password", $("#Password").val());
            }
            //密码加密
            var PublicKey = $("#RSAPublicKey").val();
            var encryptor = new JSEncrypt();
            console.log(PublicKey)
            encryptor.setPublicKey(PublicKey)
            param.Password = encryptor.encrypt(param.Password);
            CloudPost(param, "userlogin", function (res) {
                if (res.code == 0) {
                    var Token = res.data.Token;
                    SetLocalData("Token", Token);
                    if (res.data.ExistUserJob && !res.data.ExistUserJobSetting) {
                        OpenTopDialog('兼职选择', res.data.ChangeUserJobUrl + "?userguid=" + res.data.UserGuid, 300, 600, function (ReturnValue) {
                            if (ReturnValue == "OK") {
                                window.location.href = res.data.RedirectUrl;
                            }
                        })
                    } else {
                        window.location.href = res.data.RedirectUrl;
                    }

                } else {
                    OpenFail(res.data)
                }
            })
        }

        function RefreshVerifyCode() {
            CloudPost({}, "refreshhVerifyCode", function (res) {
                $("#VerfiyCodeSpan").text(res.data);
            })
        }
    </script>
</body>
</html>
